package cn.accp.kzy.service;

import java.util.List;


import cn.accp.kzy.dao.BBSReplyDao;
import cn.accp.kzy.dao.BBSTopicDao;
import cn.accp.kzy.dao.impl.BBSReplyDaoImpl;
import cn.accp.kzy.dao.impl.BBSTopicDaoImpl;
import cn.accp.kzy.model.BBSReply;
import cn.accp.kzy.util.PageInfo;

public class BBSReplyManager {

	private BBSReplyDao bbsReplyDao = new BBSReplyDaoImpl();
	private BBSTopicDao tdi = new BBSTopicDaoImpl();
	public void addReply(BBSReply reply) {
		bbsReplyDao.addReply(reply);
		tdi.updateReplyCount(reply.getTopic().getTid());
	}
	
	public List<BBSReply> getReplysByTopic(int tid, PageInfo pageInfo){
		return bbsReplyDao.getReplysByTopic(tid, pageInfo);
	}
	
	public BBSReply getBBSReplyByRid(int rid) {
		return bbsReplyDao.getBBSReplyByRid(rid);
	}
	
	public int getAllReplyCount() {
		return bbsReplyDao.getAllReplyCount();
	}
	
	public BBSReply getLastReplyByTid(int tid) {
		return bbsReplyDao.getLastReplyByTid(tid);
	}
	
	public int getTodayReplyCountBySid(int sid) {
		return bbsReplyDao.getTodayReplyCountBySid(sid);
	}
}
